import React,{Component} from "react";
import { createRoot } from "react-dom/client";
const root=createRoot(document.getElementById('id'))
class Sum extends Component{
    constructor(props){
        super(props);
        
        this.num1Ref=React.createRef();
        this.num2Ref=React.createRef();
        this.resultRef=React.createRef();

    }
    handleClick=(event)=>{
        const num1=this.num1Ref.current.value;
        const num2=this.num2Ref.current.value;
        const result=Number(num1)+Number(num2)
        this.resultRef.current.value=result
    }
    render(){
        return (
            <div>
                <input ref={this.num1Ref}/>+<input ref={this.num2Ref}/><button onClick={this.handleClick}>=</button><input/>
            </div>
        )
    }
}

